﻿namespace WMS6.Web.TransportManagement
{
    using System;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;

    public class DeliveryOrderQuery : BasePage
    {
        protected Button btnExport;
        protected Button btnList;
        protected Button btnNew;
        protected Button btnSearch;
        protected DropDownList ddlBillingType;
        protected DropDownList ddlBillingTypeOper;
        protected DropDownList ddlCreateBy;
        protected DropDownList ddlDeliveryOrderID;
        protected DropDownList ddlDeliveryOrderType;
        protected DropDownList ddlDeliveryOrderTypeOper;
        protected DropDownList ddlDeparture;
        protected DropDownList ddlDestination;
        protected DropDownList ddlExternOrderID;
        protected DropDownList ddlOwnerID;
        protected DropDownList ddlPaymentType;
        protected DropDownList ddlPaymentTypeOper;
        protected DropDownList ddlPickupType;
        protected DropDownList ddlPickupTypeOper;
        protected DropDownList ddlPriority;
        protected DropDownList ddlStatus;
        protected DropDownList ddlStatusOper;
        protected DropDownList ddlTransferType;
        protected DropDownList ddlTransferTypeOper;
        protected HtmlForm F8010;
        protected HtmlInputHidden hdnActionID;
        protected Label lblBillingType;
        protected Label lblBu;
        protected Label lblCreateBy;
        protected Label lblDeliveryOrderID;
        protected Label lblDeliveryOrderType;
        protected Label lblDeparture;
        protected Label lblDestination;
        protected Label lblExternOrderID;
        protected Label lblOwnerID;
        protected Label lblPaymentType;
        protected Label lblPickupType;
        protected Label lblPriority;
        protected Label lblStatus;
        protected Label lblTransferType;
        protected HtmlLink mycss;
        protected ScriptManager ScriptManager1;
        protected TextBox txtCreateBy;
        protected TextBox txtDeliveryOrderID;
        protected TextBox txtDeparture;
        protected TextBox txtDestination;
        protected TextBox txtExternOrderID;
        protected TextBox txtOwnerID;
        protected TextBox txtPriority;

        protected void btnList_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("DeliveryOrderList.aspx?action={0}&from=list", base.UrlEncode(this.hdnActionID.Value.Trim())), false);
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("DeliveryOrderList.aspx?action={0}", base.UrlEncode(this.hdnActionID.Value.Trim())), false);
        }

        private void LoadDll()
        {
            base.BindData2DDLBySysCode(this.ddlDeliveryOrderTypeOper, "DeliveryType");
            this.ddlDeliveryOrderTypeOper.Items.Insert(0, new ListItem("-----", ""));
            base.BindData2DDLBySysCode(this.ddlStatusOper, "DeliveryOrderStatus");
            this.ddlStatusOper.Items.Insert(0, new ListItem("-----", ""));
            base.BindData2DDLBySysCode(this.ddlTransferTypeOper, "TransportMode");
            this.ddlTransferTypeOper.Items.Insert(0, new ListItem("-----", ""));
            base.BindData2DDLBySysCode(this.ddlPickupTypeOper, "PickupType");
            this.ddlPickupTypeOper.Items.Insert(0, new ListItem("-----", ""));
            base.BindData2DDLBySysCode(this.ddlPaymentTypeOper, "PaymentType");
            this.ddlPaymentTypeOper.Items.Insert(0, new ListItem("-----", ""));
            base.BindData2DDLBySysCode(this.ddlBillingTypeOper, "BillingType");
            this.ddlBillingTypeOper.Items.Insert(0, new ListItem("-----", ""));
            base.InitQueryDDL(this.ddlDeliveryOrderID, 0);
            base.InitQueryDDL(this.ddlExternOrderID, 0);
            base.InitQueryDDL(this.ddlOwnerID, 0);
            base.InitQueryDDL(this.ddlDeliveryOrderType, 0);
            base.InitQueryDDL(this.ddlPriority, 0);
            base.InitQueryDDL(this.ddlDeparture, 0);
            base.InitQueryDDL(this.ddlDestination, 0);
            base.InitQueryDDL(this.ddlStatus, 0);
            base.InitQueryDDL(this.ddlTransferType, 0);
            base.InitQueryDDL(this.ddlPickupType, 0);
            base.InitQueryDDL(this.ddlPaymentType, 0);
            base.InitQueryDDL(this.ddlBillingType, 0);
            base.InitQueryDDL(this.ddlCreateBy, 0);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.LoadDll();
                if (!string.IsNullOrEmpty(base.Request.QueryString["action"]))
                {
                    this.btnExport.Visible = false;
                    this.btnNew.Visible = false;
                }
            }
        }

        public string BillingType
        {
            get
            {
                if (!string.IsNullOrEmpty(this.ddlBillingTypeOper.SelectedValue))
                {
                    return base.GetParamsString(this.ddlBillingTypeOper.SelectedValue, this.ddlBillingType.SelectedValue);
                }
                return "";
            }
        }

        public string CreateBy
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtCreateBy.Text.Trim()))
                {
                    return base.GetParamsString(this.txtCreateBy.Text.Trim(), this.ddlCreateBy.SelectedValue);
                }
                return "";
            }
        }

        public string DeliveryOrderID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtDeliveryOrderID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtDeliveryOrderID.Text.Trim(), this.ddlDeliveryOrderID.SelectedValue);
                }
                return "";
            }
        }

        public string DeliveryOrderType
        {
            get
            {
                if (!string.IsNullOrEmpty(this.ddlDeliveryOrderTypeOper.SelectedValue))
                {
                    return base.GetParamsString(this.ddlDeliveryOrderTypeOper.SelectedValue, this.ddlDeliveryOrderType.SelectedValue);
                }
                return "";
            }
        }

        public string Departure
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtDeparture.Text.Trim()))
                {
                    return base.GetParamsString(this.txtDeparture.Text.Trim(), this.ddlDeparture.SelectedValue);
                }
                return "";
            }
        }

        public string Destination
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtDestination.Text.Trim()))
                {
                    return base.GetParamsString(this.txtDestination.Text.Trim(), this.ddlDestination.SelectedValue);
                }
                return "";
            }
        }

        public string ExternOrderID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtExternOrderID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtExternOrderID.Text.Trim(), this.ddlExternOrderID.SelectedValue);
                }
                return "";
            }
        }

        public string OwnerID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtOwnerID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtOwnerID.Text.Trim(), this.ddlOwnerID.SelectedValue);
                }
                return "";
            }
        }

        public string PaymentType
        {
            get
            {
                if (!string.IsNullOrEmpty(this.ddlPaymentTypeOper.SelectedValue))
                {
                    return base.GetParamsString(this.ddlPaymentTypeOper.SelectedValue, this.ddlPaymentType.SelectedValue);
                }
                return "";
            }
        }

        public string PickupType
        {
            get
            {
                if (!string.IsNullOrEmpty(this.ddlPickupTypeOper.SelectedValue))
                {
                    return base.GetParamsString(this.ddlPickupTypeOper.SelectedValue, this.ddlPickupType.SelectedValue);
                }
                return "";
            }
        }

        public string Priority
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtPriority.Text.Trim()))
                {
                    return base.GetParamsString(this.txtPriority.Text.Trim(), this.ddlPriority.SelectedValue);
                }
                return "";
            }
        }

        public string Status
        {
            get
            {
                if (!string.IsNullOrEmpty(this.ddlStatusOper.SelectedValue))
                {
                    return base.GetParamsString(this.ddlStatusOper.SelectedValue, this.ddlStatus.SelectedValue);
                }
                return "";
            }
        }

        public string TransferType
        {
            get
            {
                if (!string.IsNullOrEmpty(this.ddlTransferTypeOper.SelectedValue))
                {
                    return base.GetParamsString(this.ddlTransferTypeOper.SelectedValue, this.ddlTransferType.SelectedValue);
                }
                return "";
            }
        }
    }
}

